hvmloader: Enable SCI in QEMU has it disabled.
authorKeir Fraser <keir@xen.org>
Thu, 28 Jul 2011 14:40:54 +0000 (15:40 +0100)
committerKeir Fraser <keir@xen.org>
Thu, 28 Jul 2011 14:40:54 +0000 (15:40 +0100)
When booting a Windows guest, the OS report an issue with the ACPI (in
a BSOD). The exact issue is "SCI_EN never becomes set in PM1 Control
Register." (quoted from WinDbg help).

So this patch enables the flags SCI_EN if it is not yet enabled.

Reported-by: Tobias Geiger <tobias.geiger@vido.info>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
tools/firmware/hvmloader/acpi/acpi2_0.h
tools/firmware/hvmloader/acpi/static_tables.c
tools/firmware/hvmloader/hvmloader.c

index 324cd43e38ddb06d98c7328c8b1ee276e0b35895..dcc362ad5dc7f5b2d0314def24f487c4bf86d8b5 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <stdint.h>
 #include <xen/xen.h>
+#include <xen/hvm/ioreq.h>
 
 #define ASCII32(a,b,c,d)         \
     (((a) <<  0) | ((b) <<  8) | ((c) << 16) | ((d) << 24))
@@ -252,6 +253,9 @@ struct acpi_20_fadt {
 #define ACPI_CPU_SW_SLP     (1 << 13)
 #define ACPI_USE_PLATFORM_CLOCK (1 << 15)
 
+/* PM1 Control Register Bits */
+#define ACPI_PM1C_SCI_EN    (1 << 0)
+
 /*
  * Firmware ACPI Control Structure (FACS).
  */
index cf4b8dc82535366bd64c1db260ded425edbc888c..da61304f4645b7c099de819af3b408f68e83b65e 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "acpi2_0.h"
 #include "../config.h"
-#include <xen/hvm/ioreq.h>
 
 /*
  * Firmware ACPI Control Structure (FACS).
index 5e7d1283071823d4213a4703a2d8ef1a57194b83..4129670fc7f98e0ef5987ac9fd7e189bf114df33 100644 (file)
@@ -26,6 +26,7 @@
 #include "pci_regs.h"
 #include "option_rom.h"
 #include "apic_regs.h"
+#include "acpi/acpi2_0.h"
 #include <xen/version.h>
 #include <xen/hvm/params.h>
 
@@ -379,6 +380,25 @@ static const struct bios_config *detect_bios(void)
     return NULL;
 }
 
+static void acpi_enable_sci(void)
+{
+    uint8_t pm1a_cnt_val;
+
+#define PIIX4_SMI_CMD_IOPORT 0xb2
+#define PIIX4_ACPI_ENABLE    0xf1
+
+    /*
+     * PIIX4 emulation in QEMU has SCI_EN=0 by default. We have no legacy
+     * SMM implementation, so give ACPI control to the OSPM immediately.
+     */
+    pm1a_cnt_val = inb(ACPI_PM1A_CNT_BLK_ADDRESS_V1);
+    if ( !(pm1a_cnt_val & ACPI_PM1C_SCI_EN) )
+        outb(PIIX4_SMI_CMD_IOPORT, PIIX4_ACPI_ENABLE);
+
+    pm1a_cnt_val = inb(ACPI_PM1A_CNT_BLK_ADDRESS_V1);
+    BUG_ON(!(pm1a_cnt_val & ACPI_PM1C_SCI_EN));
+}
+
 int main(void)
 {
     const struct bios_config *bios;
@@ -481,6 +501,8 @@ int main(void)
             bios->acpi_build_tables();
         }
 
+        acpi_enable_sci();
+
         hypercall_hvm_op(HVMOP_set_param, &p);
     }